﻿
@using Kugar.Core.ExtMethod
@using Kugar.Core.Web.ViewModel

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <link rel="stylesheet" href="/content/main.css" />

    <title>后台登陆页</title>
    <style>
        body {
            background: url(/content/images/bg.png) no-repeat;
        }
    </style>
    <script type="text/javascript">
        function login() {
            var userName = $('#txtUserName').val();
            var password = $('#txtPassword').val();

            if (userName == "") {
                alert("用户名不能为空");
                return false;
            }

            if (password == "") {
                alert("密码不能为空");
                return false;
            }

            $('form').submit();

            return true;
        }

        $(document).ready(function() {
            $('#txtUserName').keydown(function(e) {
                if (e.keyCode === 13) {
                    $('#txtPassword').focus();
                }
            });

            $('#txtPassword').keydown(function(e) {
                if (e.keyCode===13) {
                    $('#btnOK').click();
                }
            })
        });
    </script>
    <script type="text/javascript">
        @{
            var lst = (List<Kugar.MVC.DaemonUI.VM_MVCMsgBoxItem>)TempData["MsgData_Temp"];

            if (lst.HasData())
            {
                foreach (var item in lst)
                {
                    if (!string.IsNullOrWhiteSpace(item.Message))
                    {
                        @Html.Raw(string.Format("alert('{0}');", item.Message))

                    }

                    if (!string.IsNullOrWhiteSpace(item.JavsScript))
                    {
                        @Html.Raw(item.JavsScript)
                    }
                }
            }


        }
    </script>
</head>

<body>


<div class="lg-block">
    <form method="POST">

        <div class="lg-title"><span class="lg-logo"><img src="/content/images/logo.png" /></span><span style="padding-left: 12px;">维思后台</span></div>
        <div class="lg-txt">
            <span><i class="icons icons-name"></i></span><input id="txtUserName" name="UserName" type="text" value="@ViewBag.UserName" placeholder="请输入用户名"/>
        </div>
        <div class="lg-txt">
            <span><i class="icons icons-pass"></i></span><input id="txtPassword" name="Password" type="password" value="@ViewBag.Password" placeholder="请输入密码"/>
        </div>
        <a id="btnOK" class="lg-btn" onclick="javascript: login();">立即登录</a>

    </form>
</div>
</body>
</html>
